home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 July: Mac OS SDK / Dev.CD Jul 96 SDK / Dev.CD Jul 96 SDK1.toast / Development Kits (Disc 1) / AOCE / Development Tools / Interfaces / CIncludes / OCE.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-11-10  |  49.3 KB  |  1,627 lines  |  [TEXT/MPS ]

  1. /************************************************************
  2.  
  3. Created: Friday, June 4, 1993 at 10:05AM
  4.  OCE.h
  5.  C Interface to the Macintosh Libraries
  6.  
  7.   Copyright Apple Computer, Inc. 1990-1993
  8.   All rights reserved
  9.  
  10. ************************************************************/
  11.  
  12.  
  13. #ifndef    __OCE__
  14. #define __OCE__
  15.  
  16. #ifndef    REZ
  17.  
  18. #ifndef __ALIASES__
  19. #include <Aliases.h>                    /* for AliasPtr */
  20. #endif
  21.  
  22. #ifndef __APPLEEVENTS__
  23. #include <AppleEvents.h>                /* for DescType */
  24. #endif
  25.  
  26. #ifndef __SCRIPT__
  27. #include <Script.h>                        /* for smRoman */
  28. #endif
  29.  
  30. #ifndef __TYPES__
  31. #include <Types.h>
  32. #endif
  33.  
  34.  
  35. /*
  36. All utility routines defined here are callable at interrupt level.
  37. */
  38.  
  39.  
  40. /*
  41. Defines for the trap selector values.  
  42.  
  43. Note:  Some selector values also chosen from this same range of numbers appear
  44. in the file OCEMessaging.h.  Check there before you add a new value.
  45. */
  46.  
  47. #ifdef __ADASTYPES_IMPLEMENTATION
  48. #define __OCEUtils(selector)
  49. #else
  50. #define __OCEUtils(selector) = { 0x303C, selector, 0xAA5C }
  51. #endif
  52.  
  53. #define kOCECopyCreationID                    768
  54. #define kOCECopyDirDiscriminator            769
  55. #define kOCECopyLocalRecordID                770
  56. #define kOCECopyPackedDSSpec                771
  57. #define kOCECopyPackedPathName                772
  58. #define kOCECopyPackedRLI                    773
  59. #define kOCECopyPackedRecordID                774
  60. #define kOCECopyRLI                            775
  61. #define kOCECopyRString                        776
  62. #define kOCECopyRecordID                    777
  63. #define kOCECopyShortRecordID                778
  64. #define kOCEDuplicateRLI                    779
  65. #define kOCEEqualCreationID                    780
  66. #define kOCEEqualDirDiscriminator            781
  67. #define kOCEEqualDSSpec                        782
  68. #define kOCEEqualLocalRecordID                783
  69. #define kOCEEqualPackedDSSpec                784
  70. #define kOCEEqualPackedPathName                785
  71. #define kOCEEqualPackedRecordID                786
  72. #define kOCEEqualPackedRLI                    787
  73. #define kOCEEqualRecordID                    788
  74. #define kOCEEqualRLI                        789
  75. #define kOCEEqualRString                    790
  76. #define kOCEEqualShortRecordID                791
  77. #define kOCEExtractAlias                    792
  78. #define kOCEGetDSSpecInfo                    793
  79. #define kOCEGetIndAttributeType                794
  80. #define kOCEGetIndRecordType                795
  81. #define kOCEGetXtnType                        796
  82. #define kOCEIsNullPackedPathName            797
  83. #define kOCENewLocalRecordID                798
  84. #define kOCENewRLI                            799
  85. #define kOCENewRecordID                        800
  86. #define kOCENewShortRecordID                801
  87. #define kOCEPackDSSpec                        802
  88. #define kOCEPackPathName                    803
  89. #define kOCEPackRLI                            804
  90. #define kOCEPackRLIParts                    805
  91. #define kOCEPackRecordID                    806
  92. #define kOCEPackedDSSpecSize                807
  93. #define kOCEPackedPathNameSize                808
  94. #define kOCEPackedRLIPartsSize                809
  95. #define kOCEPackedRLISize                    810
  96. #define kOCEPackedRecordIDSize                811
  97. #define kOCEDNodeNameCount                    812
  98. #define kOCERelRString                        813
  99. #define kOCESetCreationIDtoNull                814
  100. #define kOCEUnpackDSSpec                    815
  101. #define kOCEUnpackPathName                    816
  102. #define kOCEUnpackRLI                        817
  103. #define kOCEUnpackRecordID                    818
  104. #define kOCEValidPackedDSSpec                819
  105. #define kOCEValidPackedPathName                820
  106. #define kOCEValidPackedRecordID                821
  107. #define kOCEValidPackedRLI                    822
  108. #define kOCEValidRLI                        823
  109. #define kOCEValidRString                    824
  110. #define kOCECToRString                        825
  111. #define kOCEPToRString                        826
  112. #define kOCERToPString                        827
  113. #define kOCEPathFinderCID                    828
  114. #define kOCEStreamPackedDSSpec                829
  115.  
  116. #define kOCENullCID                            836
  117. #define kOCEGetAccessControlDSSpec            837
  118. #define    kOCEGetRootPackedRLI                838
  119.  
  120.  
  121. /* Miscellaneous defines:  (these cannot be made into enums) */
  122.  
  123. #define kMinPackedRStringLength (sizeof (ProtoRString))
  124.  
  125. #define kMinPackedRLISize (sizeof (ProtoPackedRLI) +\
  126.             sizeof (DirDiscriminator) + sizeof (DNodeNum) +\
  127.             kMinPackedRStringLength + sizeof (ProtoPackedPathName))
  128.  
  129. #define kRLIMaxBytes (sizeof (RString) + sizeof (DirDiscriminator) + \
  130.             sizeof (DNodeNum) + kPathNameMaxBytes)
  131.  
  132. #define kPackedRecordIDMaxBytes (kPathNameMaxBytes + sizeof (DNodeNum) + \
  133.             sizeof (DirDiscriminator) + sizeof (CreationID) + (3 * sizeof (RString)))
  134.  
  135. #define kPackedDSSpecMaxBytes    (sizeof (PackedRecordID) + sizeof (OSType) + \
  136.             sizeof (unsigned short))
  137.  
  138.  
  139.  
  140. typedef unsigned short OCERecordTypeIndex;
  141. typedef unsigned short OCEAttributeTypeIndex;
  142.  
  143. #endif
  144.  
  145. /*
  146. All these standard definitions begin with the Apple symbol (not shown here).
  147.  
  148. NOTE:  To access these, you must call OCEGetIndRecordType or OCEGetIndAttributeType
  149. with the proper index.  These routines return pointers to the standard type.
  150. This was done so that code fragments (INITs, CDEVs, CSAMs, etc). which cannot
  151. use global data can also use these.
  152. */
  153.  
  154. /* Indices for the standard definitions for certain record types (OCERecordTypeIndex): */
  155.  
  156. #define        kUserRecTypeNum             1        /* "User" */
  157. #define        kGroupRecTypeNum            2        /* "Group" */
  158. #define        kMnMRecTypeNum                3        /* "AppleMail™ M&M" */
  159. #define        kMnMForwarderRecTypeNum        4        /* "AppleMail™ Fwdr" */
  160. #define        kNetworkSpecRecTypeNum        5        /* "NetworkSpec" */
  161. #define        kADAPServerRecTypeNum        6        /* "ADAP Server" */
  162. #define        kADAPDNodeRecTypeNum        7        /* "ADAP DNode" */
  163. #define        kADAPDNodeRepRecTypeNum        8        /* "ADAP DNode Rep" */
  164. #define        kServerSetupRecTypeNum        9        /* "Server Setup" */
  165. #define        kDirectoryRecTypeNum        10        /* "Directory" */
  166. #define        kDNodeRecTypeNum            11        /* "DNode" */
  167. #define        kSetupRecTypeNum            12        /* "Setup" */
  168. #define        kMSAMRecTypeNum                13        /* "MSAM" */
  169. #define        kDSAMRecTypeNum                14        /* "DSAM" */
  170. #define        kAttributeValueRecTypeNum    15        /* "Attribute Value" */
  171. #define        kBusinessCardRecTypeNum        16        /* "Business Card" */
  172. #define        kMailServiceRecTypeNum        17        /* "Mail Service" */
  173. #define        kCombinedRecTypeNum            18        /* "Combined" */
  174. #define        kOtherServiceRecTypeNum        19        /* "Other Service" */
  175. #define        kAFPServiceRecTypeNum        20        /* "Other Service afps" */
  176.  
  177. #define        kFirstOCERecTypeNum    kUserRecTypeNum            /* first standard OCE record type */
  178. #define        kLastOCERecTypeNum    kAFPServiceRecTypeNum    /* last standard OCE record type */
  179. #define        kNumOCERecTypes        (kLastOCERecTypeNum - kFirstOCERecTypeNum + 1)
  180.  
  181.  
  182. /* Indices for the standard definitions for certain attribute types (OCEAttributeTypeIndex): */
  183.  
  184. #define        kMemberAttrTypeNum            1001    /* "Member" */
  185. #define        kAdminsAttrTypeNum            1002    /* "Administrators" */
  186. #define        kMailSlotsAttrTypeNum        1003    /* "mailslots" */
  187. #define        kPrefMailAttrTypeNum        1004    /* "pref mailslot" */
  188. #define        kAddressAttrTypeNum            1005    /* "Address" */
  189. #define        kPictureAttrTypeNum            1006    /* "Picture" */
  190. #define        kAuthKeyAttrTypeNum            1007    /* "auth key" */
  191. #define        kTelephoneAttrTypeNum        1008    /* "Telephone" */
  192. #define        kNBPNameAttrTypeNum            1009    /* "NBP Name" */
  193. #define        kQMappingAttrTypeNum        1010    /* "ForwarderQMap" */
  194. #define        kDialupSlotAttrTypeNum        1011    /* "DialupSlotInfo" */
  195. #define        kHomeNetAttrTypeNum            1012    /* "Home Internet" */
  196. #define        kCoResAttrTypeNum            1013    /* "Co-resident M&M" */
  197. #define        kFwdrLocalAttrTypeNum        1014    /* "FwdrLocalRecord" */
  198. #define        kConnectAttrTypeNum            1015    /* "Connected To" */
  199. #define        kForeignAttrTypeNum            1016    /* "Foreign RLIs" */
  200. #define        kOwnersAttrTypeNum            1017    /* "Owners" */
  201. #define        kReadListAttrTypeNum        1018    /* "ReadList" */
  202. #define        kWriteListAttrTypeNum        1019    /* "WriteList" */
  203. #define        kDescriptorAttrTypeNum        1020    /* "Descriptor" */
  204. #define        kCertificateAttrTypeNum        1021    /* "Certificate" */
  205. #define        kMsgQsAttrTypeNum            1022    /* "MessageQs" */
  206. #define        kPrefMsgQAttrTypeNum        1023    /* "PrefMessageQ" */
  207. #define        kMasterPFAttrTypeNum        1024    /* "MasterPF" */
  208. #define        kMasterNetSpecAttrTypeNum    1025    /* "MasterNetSpec" */
  209. #define        kServersOfAttrTypeNum        1026    /* "Servers Of" */
  210. #define        kParentCIDAttrTypeNum        1027    /* "Parent CID" */
  211. #define        kNetworkSpecAttrTypeNum        1028    /* "NetworkSpec" */
  212. #define        kLocationAttrTypeNum        1029    /* "Location" */
  213. #define        kTimeSvrTypeAttrTypeNum        1030    /* "TimeServer Type" */
  214. #define        kUpdateTimerAttrTypeNum        1031    /* "Update Timer" */
  215. #define        kShadowsOfAttrTypeNum        1032    /* "Shadows Of" */
  216. #define        kShadowServerAttrTypeNum    1033    /* "Shadow Server" */
  217. #define        kTBSetupAttrTypeNum            1034    /* "TB Setup" */
  218. #define        kMailSetupAttrTypeNum        1035    /* "Mail Setup" */
  219. #define        kSlotIDAttrTypeNum            1036    /* "SlotID" */
  220. #define        kGatewayFileIDAttrTypeNum    1037    /* "Gateway FileID" */
  221. #define        kMailServiceAttrTypeNum        1038    /* "Mail Service" */
  222. #define        kStdSlotInfoAttrTypeNum        1039    /* "Std Slot Info" */
  223. #define        kAssoDirectoryAttrTypeNum    1040    /* "Asso. Directory" */
  224. #define        kDirectoryAttrTypeNum        1041    /* "Directory" */
  225. #define        kDirectoriesAttrTypeNum        1042    /* "Directories" */
  226. #define        kSFlagsAttrTypeNum            1043    /* "SFlags" */
  227. #define        kLocalNameAttrTypeNum        1044    /* "Local Name" */
  228. #define        kLocalKeyAttrTypeNum        1045    /* "Local Key" */
  229. #define        kDirUserRIDAttrTypeNum        1046    /* "Dir User RID" */
  230. #define        kDirUserKeyAttrTypeNum        1047    /* "Dir User Key" */
  231. #define        kDirNativeNameAttrTypeNum    1048    /* "Dir Native Name" */
  232. #define        kCommentAttrTypeNum            1049    /* "Comment" */
  233. #define        kRealNameAttrTypeNum        1050    /* "Real Name" */
  234. #define        kPrivateDataAttrTypeNum        1051    /* "Private Data" */
  235. #define        kDirTypeAttrTypeNum            1052    /* "Directory Type" */
  236. #define        kDSAMFileAliasAttrTypeNum    1053    /* "DSAM File Alias" */
  237. #define        kCanAddressToAttrTypeNum    1054    /* "Can Address To" */
  238. #define        kDiscriminatorAttrTypeNum    1055    /* "Discriminator" */
  239. #define        kAliasAttrTypeNum            1056    /* "Alias" */
  240. #define        kParentMSAMAttrTypeNum        1057    /* "Parent MSAM" */
  241. #define        kParentDSAMAttrTypeNum        1058    /* "Parent DSAM" */
  242. #define        kSlotAttrTypeNum            1059    /* "Slot" */
  243. #define        kAssoMailServiceAttrTypeNum    1060    /* "Asso. Mail Service" */
  244. #define        kFakeAttrTypeNum            1061    /* "Fake" */
  245. #define        kInheritSysAdminAttrTypeNum    1062    /* "Inherit SysAdministrators" */
  246. #define        kPreferredPDAttrTypeNum        1063    /* "Preferred PD" */
  247. #define        kLastLoginAttrTypeNum        1064    /* "Last Login" */
  248. #define        kMailerAOMStateAttrTypeNum    1065    /* "Mailer AOM State" */
  249. #define        kMailerSendOptionsAttrTypeNum 1066    /* "Mailer Send Options" */
  250. #define        kJoinedAttrTypeNum            1067    /* "Joined" */
  251. #define        kUnconfiguredAttrTypeNum    1068    /* "Unconfigured" */
  252. #define        kVersionAttrTypeNum            1069    /* "Version" */
  253. #define        kLocationNamesAttrTypeNum    1070    /* "Location Names" */
  254. #define        kActiveAttrTypeNum            1071    /* "Active" */
  255. #define        kDeleteRequestedAttrTypeNum    1072    /* "Delete Requested" */
  256. #define        kGatewayTypeAttrTypeNum        1073    /* "Gateway Type" */
  257.  
  258. #define        kFirstOCEAttrTypeNum    kMemberAttrTypeNum    /* first standard OCE attr type */
  259. #define        kLastOCEAttrTypeNum        kGatewayTypeAttrTypeNum    /* last standard OCE attr type */
  260. #define        kNumOCEAttrTypes        (kLastOCEAttrTypeNum - kFirstOCEAttrTypeNum + 1)
  261.  
  262.  
  263. /* For anyone who absolutely needs a define of the body of the standard record or
  264. attribute type, use these below.  CAUTION!  All the types below are assumed to be
  265. in character set 'smRoman'.  If you try to compare these to some RString or
  266. AttributeType variable, you must take the character set code into account.  Future
  267. standard types may be defined using character sets other than 'smRoman'.
  268. */
  269.  
  270. /* Standard definitions for certain record types: */
  271.  
  272. #define        kUserRecTypeBody             "aoce User"
  273. #define        kGroupRecTypeBody            "aoce Group"
  274. #define        kMnMRecTypeBody                "aoce AppleMail™ M&M"
  275. #define        kMnMForwarderRecTypeBody    "aoce AppleMail™ Fwdr"
  276. #define        kNetworkSpecRecTypeBody        "aoce NetworkSpec"
  277. #define        kADAPServerRecTypeBody        "aoce ADAP Server"
  278. #define        kADAPDNodeRecTypeBody        "aoce ADAP DNode"
  279. #define        kADAPDNodeRepRecTypeBody    "aoce ADAP DNode Rep"
  280. #define        kServerSetupRecTypeBody        "aoce Server Setup"
  281. #define        kDirectoryRecTypeBody        "aoce Directory"
  282. #define        kDNodeRecTypeBody            "aoce DNode"
  283. #define        kSetupRecTypeBody            "aoce Setup"
  284. #define        kMSAMRecTypeBody            "aoce MSAM"
  285. #define        kDSAMRecTypeBody            "aoce DSAM"
  286. #define        kAttributeValueRecTypeBody    "aoce Attribute Value"
  287. #define        kBusinessCardRecTypeBody    "aoce Business Card"
  288. #define        kMailServiceRecTypeBody        "aoce Mail Service"
  289. #define        kCombinedRecTypeBody        "aoce Combined"
  290. #define        kOtherServiceRecTypeBody    "aoce Other Service"
  291. #define        kAFPServiceRecTypeBody        "aoce Other Service afps"
  292.  
  293. /* Standard definitions for certain attribute types: */
  294.  
  295. #define        kMemberAttrTypeBody            "aoce Member"
  296. #define        kAdminsAttrTypeBody            "aoce Administrators"
  297. #define        kMailSlotsAttrTypeBody        "aoce mailslots"
  298. #define        kPrefMailAttrTypeBody        "aoce pref mailslot"
  299. #define        kAddressAttrTypeBody        "aoce Address"
  300. #define        kPictureAttrTypeBody        "aoce Picture"
  301. #define        kAuthKeyAttrTypeBody        "aoce auth key"
  302. #define        kTelephoneAttrTypeBody        "aoce Telephone"
  303. #define        kNBPNameAttrTypeBody        "aoce NBP Name"
  304. #define        kQMappingAttrTypeBody        "aoce ForwarderQMap"
  305. #define        kDialupSlotAttrTypeBody        "aoce DialupSlotInfo"
  306. #define        kHomeNetAttrTypeBody        "aoce Home Internet"
  307. #define        kCoResAttrTypeBody            "aoce Co-resident M&M"
  308. #define        kFwdrLocalAttrTypeBody        "aoce FwdrLocalRecord"
  309. #define        kConnectAttrTypeBody        "aoce Connected To"
  310. #define        kForeignAttrTypeBody        "aoce Foreign RLIs"
  311. #define        kOwnersAttrTypeBody            "aoce Owners"
  312. #define        kReadListAttrTypeBody        "aoce ReadList"
  313. #define        kWriteListAttrTypeBody        "aoce WriteList"
  314. #define        kDescriptorAttrTypeBody        "aoce Descriptor"
  315. #define        kCertificateAttrTypeBody    "aoce Certificate"
  316. #define        kMsgQsAttrTypeBody            "aoce MessageQs"
  317. #define        kPrefMsgQAttrTypeBody        "aoce PrefMessageQ"
  318. #define        kMasterPFAttrTypeBody        "aoce MasterPF"
  319. #define        kMasterNetSpecAttrTypeBody    "aoce MasterNetSpec"
  320. #define        kServersOfAttrTypeBody        "aoce Servers Of"
  321. #define        kParentCIDAttrTypeBody        "aoce Parent CID"
  322. #define        kNetworkSpecAttrTypeBody    "aoce NetworkSpec"
  323. #define        kLocationAttrTypeBody        "aoce Location"
  324. #define        kTimeSvrTypeAttrTypeBody    "aoce TimeServer Type"
  325. #define        kUpdateTimerAttrTypeBody    "aoce Update Timer"
  326. #define        kShadowsOfAttrTypeBody        "aoce Shadows Of"
  327. #define        kShadowServerAttrTypeBody    "aoce Shadow Server"
  328. #define        kTBSetupAttrTypeBody        "aoce TB Setup"
  329. #define        kMailSetupAttrTypeBody        "aoce Mail Setup"
  330. #define        kSlotIDAttrTypeBody            "aoce SlotID"
  331. #define        kGatewayFileIDAttrTypeBody    "aoce Gateway FileID"
  332. #define        kMailServiceAttrTypeBody    "aoce Mail Service"
  333. #define        kStdSlotInfoAttrTypeBody    "aoce Std Slot Info"
  334. #define        kAssoDirectoryAttrTypeBody    "aoce Asso. Directory"
  335. #define        kDirectoryAttrTypeBody        "aoce Directory"
  336. #define        kDirectoriesAttrTypeBody    "aoce Directories"
  337. #define        kSFlagsAttrTypeBody            "aoce SFlags"
  338. #define        kLocalNameAttrTypeBody        "aoce Local Name"
  339. #define        kLocalKeyAttrTypeBody        "aoce Local Key"
  340. #define        kDirUserRIDAttrTypeBody        "aoce Dir User RID"
  341. #define        kDirUserKeyAttrTypeBody        "aoce Dir User Key"
  342. #define        kDirNativeNameAttrTypeBody    "aoce Dir Native Name"
  343. #define        kCommentAttrTypeBody        "aoce Comment"
  344. #define        kRealNameAttrTypeBody        "aoce Real Name"
  345. #define        kPrivateDataAttrTypeBody    "aoce Private Data"
  346. #define        kDirTypeAttrTypeBody        "aoce Directory Type"
  347. #define        kDSAMFileAliasAttrTypeBody    "aoce DSAM File Alias"
  348. #define        kCanAddressToAttrTypeBody    "aoce Can Address To"
  349. #define        kDiscriminatorAttrTypeBody    "aoce Discriminator"
  350. #define        kAliasAttrTypeBody            "aoce Alias"
  351. #define        kParentMSAMAttrTypeBody        "aoce Parent MSAM"
  352. #define        kParentDSAMAttrTypeBody        "aoce Parent DSAM"
  353. #define        kSlotAttrTypeBody            "aoce Slot"
  354. #define        kAssoMailServiceAttrTypeBody "aoce Asso. Mail Service"
  355. #define        kFakeAttrTypeBody            "aoce Fake"
  356. #define        kInheritSysAdminAttrTypeBody "aoce Inherit SysAdministrators"
  357. #define        kPreferredPDAttrTypeBody    "aoce Preferred PD"
  358. #define        kLastLoginAttrTypeBody        "aoce Last Login"
  359. #define        kMailerAOMStateAttrTypeBody    "aoce Mailer AOM State"
  360. #define        kMailerSendOptionsAttrTypeBody "aoce Mailer Send Options"
  361. #define        kJoinedAttrTypeBody            "aoce Joined"
  362. #define        kUnconfiguredAttrTypeBody    "aoce Unconfigured"
  363. #define        kVersionAttrTypeBody        "aoce Version"
  364. #define        kLocationNamesAttrTypeBody    "aoce Location Names"
  365. #define        kActiveAttrTypeBody            "aoce Active"
  366. #define        kDeleteRequestedAttrTypeBody "aoce Delete Requested"
  367. #define        kGatewayTypeAttrTypeBody     "aoce Gateway Type"
  368.  
  369.  
  370.  
  371. #ifndef    REZ
  372.  
  373. /* Miscellaneous enums: */
  374.  
  375. enum {
  376.     kRString32Size            = 32,        /* max size of the body field in RString32 */
  377.     kRString64Size            = 64,        /* max size of the body field in RString64 */
  378.     kNetworkSpecMaxBytes    = 32,        /* max size of the body field in NetworkSpec */
  379.     kPathNameMaxBytes        = 1024,        /* max size of the data field in PackedPathName */
  380.     kDirectoryNameMaxBytes    = 32,        /* max size of the body field in DirectoryName */
  381.     kAttributeTypeMaxBytes    = 32,        /* max size of the body field in AttributeType */
  382.     kAttrValueMaxBytes        = 65536,    /* max size of any attribute value */
  383.     kRStringMaxBytes        = 256,        /* max size (in bytes) of the body field of a recordName or recordType */
  384.     kRStringMaxChars        = 128        /* max size (in chars) of the body field of a recordName or recordType */
  385. };
  386.  
  387. enum {
  388.     kNULLDNodeNumber = 0,                /* Special value meaning none specified */
  389.     kRootDNodeNumber = 2                /* DNodeNum corresponding to the root of the tree */
  390. };
  391.  
  392.  
  393. /*
  394. This enum is used to select the kind of RString in calls such as OCERelRString,
  395. OCEEqualRString, and OCEValidRString.
  396.  
  397. eGenericSensitive and eGenericInsensitive are enumerators that can be used if you
  398. use RStrings for things other than what you see in this file.  If you want them to
  399. be compared in a case- and diacritical-sensitive manner (c ≠ C ≠ ç), use
  400. eGenericSensitive.  If you want them to be compared in a case- and diacritical-
  401. insensitive manner (c = C = ç), use eGenericInensitive.
  402. WARNING:  do not use eGenericSensitive and eGenericInsensitive with catalog
  403. names, entity names, pathname parts, entity types, network specs, or attribute
  404. types!  Don't assume that you know how they should be compared!!!
  405. */
  406.  
  407. enum /* RStringKind */ {
  408.     kOCEDirName                        = 0,
  409.     kOCERecordOrDNodeName            = 1,
  410.     kOCERecordType                    = 2,
  411.     kOCENetworkSpec                    = 3,
  412.     kOCEAttrType                    = 4,
  413.     kOCEGenericSensitive            = 5,
  414.     kOCEGenericInsensitive            = 6
  415. };
  416.  
  417. typedef unsigned short RStringKind;
  418.  
  419.  
  420. /* Values for the signature field in Discriminator */
  421.  
  422. enum /* OCEDirectoryKind */ {
  423.     kDirAllKinds                = 0,
  424.     kDirADAPKind                = 'adap',
  425.     kDirPersonalDirectoryKind    = 'pdir',
  426.     kDirDSAMKind                = 'dsam'
  427. };
  428.  
  429. typedef unsigned long OCEDirectoryKind;
  430.  
  431.  
  432. /* Values returned by GetDSSpecInfo() */
  433.  
  434. enum {
  435.     kOCEInvalidDSSpec    = 0x3F3F3F3FL,    /* '????' */    /* could not be determined */
  436.     kOCEDirsRootDSSpec    = 'root',                        /* root of all catalogs ("Catalogs" icon) */
  437.     kOCEDirectoryDSSpec    = 'dire',                        /* catalog */
  438.     kOCEDNodeDSSpec        = 'dnod',                        /* d-node */
  439.     kOCERecordDSSpec    = 'reco',                        /* record */
  440.     kOCEentnDSSpec        = 'entn',                        /* extensionType is 'entn' */
  441.     kOCENOTentnDSSpec    = 'not '                        /* extensionType is not 'entn' */
  442. };
  443.  
  444.  
  445. /* Values for AttributeTag */
  446.  
  447. enum {
  448.     typeRString            = 'rstr',
  449.     typePackedDSSpec    = 'dspc',
  450.     typeBinary            = 'bnry'
  451. };
  452.  
  453.  
  454. /*
  455. Bit flag corresponding to the canContainRecords bit.  Use it like this:
  456.     if (foo & kCanContainRecords)
  457.         then this dNode can contain records!
  458. kForeignNode is used to indicate nodes in the name hierarchy that correspond to
  459. foreign catalogs (meaning ADAP sees no clusters or DNodes beneath it, but
  460. mail routers might be able to route to clusters beneath it.
  461. */
  462.  
  463. enum {
  464.     kCanContainRecordsBit,
  465.     kForeignNodeBit
  466.     };
  467.  
  468. enum /* DirNodeKind */ {
  469.     kCanContainRecords        = 1L<<kCanContainRecordsBit,
  470.     kForeignNode            = 1L<<kForeignNodeBit
  471. };
  472.  
  473. typedef unsigned long DirNodeKind;
  474.  
  475.  
  476.  
  477.  
  478. /**** Toolbox Control ****/
  479.  
  480. /*
  481. We will have a version number and attributes for toolboxes off the aa5e trap
  482. and the S&F server trap.
  483.  
  484. This includes the OCE toolbox and S&F Server.  [Note: the S&F server will
  485. change to ONLY service ServerGateway calls —it will then be necessary to run
  486. it co–resident with an OCE toolbox].
  487.  
  488. The high order word will represent the S&F Server version number.  The low
  489. order word will represent the OCE toolbox version number.  These will be zero
  490. until the component is up and running.  It is not possible to know these
  491. a–priori. Note: there will not be a seperate version numbers for each component
  492. in the OCE toolbox or S&F server.
  493.  
  494. The above is consistent with the standard System 7.0 usage of Gestalt.
  495.  
  496. The oce tb attribute gestaltOCETBPresent implies the existence of OCE on a
  497. machine.
  498.  
  499. The OCE TB attribute gestaltOCETBAvailable implies the availablity of OCE calls.
  500.  
  501. The attribute gestaltOCESFServerAvailable implies the availablity of OCE calls
  502. available through the S&F server. This are essentially the server gateway calls.
  503.  
  504. Any (future) remaining OCE attributes may not be established correctly until
  505. the attribute gestaltOCETBAvailable is set.
  506.  
  507. The gestalt selectors and values are listed below:
  508. */
  509.  
  510. enum {
  511.     gestaltOCEToolboxVersion    = 'ocet',    /* OCE Toolbox version */
  512.     gestaltOCEToolboxAttr        = 'oceu'    /* OCE Toolbox attributes */
  513. };
  514.  
  515. enum {
  516. /* version includes:
  517.  *  dirtb
  518.  *  authtb
  519.  *  mailtb
  520.  *  ipmtb
  521.  *  personal catalog
  522.  *  ADSPSecure
  523.  * e.g. all interfaces dependent on the aa5e trap.
  524. */
  525.     gestaltOCETB                = 0x0100,    /* OCE Toolbox version 1.0 */
  526.     gestaltSFServer                = 0x0100,    /* S&F Server version 1.0 */
  527.     gestaltOCETBPresent            = 0x1,        /* OCE toolbox is present, not running */
  528.     gestaltOCETBAvailable        = 0x2,        /* OCE toolbox is running and available */
  529.     gestaltOCESFServerAvailable    = 0x4        /* S&F Server is running and available */
  530. };
  531.  
  532. /*    Constants used for Transitions. */
  533.  
  534. enum {
  535.     ATTransIPMStart        = 'ipms',
  536.     ATTransIPMShutdown    = 'ipmd',
  537.     ATTransDirStart        = 'dirs',
  538.     ATTransDirShutdown    = 'dird',
  539.     ATTransAuthStart    = 'auts',
  540.     ATTransAuthShutdown    = 'autd',
  541.     ATTransSFStart        = 's&fs',
  542.     ATTransSFShutdown    = 's&fd'
  543. };
  544.  
  545.  
  546.  
  547. /* Some definitions for time-related parameters: */
  548.  
  549. typedef unsigned long    UTCTime;        /* Interpreted as UTC seconds since 1/1/1904 */
  550. typedef long            UTCOffset;        /* seconds EAST of Greenwich */
  551.  
  552.  
  553. typedef short CharacterSet;                /* This is the same as the ScriptManager script. */
  554.  
  555.  
  556. /**** RString ****/
  557.  
  558.  
  559. /*
  560. struct RString is a maximum-sized structure.  Allocate one of these and it will
  561. hold any valid RString.
  562. */
  563.  
  564. #define RStringHeader        \
  565.     CharacterSet charSet;    \
  566.     unsigned short dataLength;
  567.  
  568. struct RString {
  569.     RStringHeader
  570.     Byte    body[kRStringMaxBytes];        /* place for characters */
  571. };
  572.  
  573. typedef struct RString RString;
  574.  
  575. /* struct ProtoRString is a minimum-sized structure.  Use this for a variable-length
  576. RString. */
  577.  
  578. struct ProtoRString {                    /* proto-RString used for variable length rStrings */
  579.     RStringHeader
  580. /* Followed by body */
  581. };
  582.  
  583. typedef struct ProtoRString ProtoRString;
  584. typedef RString *RStringPtr, **RStringHandle;
  585. typedef ProtoRString *ProtoRStringPtr;
  586.  
  587. struct RString64 {
  588.     RStringHeader
  589.     Byte            body[kRString64Size];
  590. };
  591. typedef struct RString64 RString64;
  592.  
  593. struct RString32 {
  594.     RStringHeader
  595.     Byte            body[kRString32Size];
  596. };
  597. typedef struct RString32 RString32;
  598.  
  599.  
  600. #ifdef    __cplusplus
  601. extern "C" {
  602. #endif
  603.  
  604.  
  605. /*
  606. Standard definitions for the entity type field and attribute type
  607. have been moved to the end of the file.
  608. */
  609.  
  610.  
  611. /*
  612. Copies str1 to str2.  str2Length is the size of str2, excluding header.
  613. A memFull error will be returned if that is not as large as str1->dataLength.
  614. */
  615.  
  616. pascal OSErr OCECopyRString (const RString *str1, RString *str2, unsigned short str2Length)
  617.     __OCEUtils(kOCECopyRString);
  618.  
  619.  
  620. /*    Make an RString from a C string.  If the c string is bigger than rStrLength,
  621. only rStrLength bytes will be copied. (rStrLength does not include the header size) */
  622.  
  623. pascal void OCECToRString (const char *cStr, CharacterSet charSet, RString *rStr,
  624.         unsigned short rStrLength)
  625.     __OCEUtils(kOCECToRString);
  626.  
  627.  
  628. /*    Make an RString from a Pascal string.  If the Pascal string is bigger than rStrLength,
  629. only rStrLength bytes will be copied. (rStrLength does not include the header size) */
  630.  
  631. pascal void OCEPToRString(ConstStr255Param pStr, CharacterSet charSet, RString *rStr,
  632.         unsigned short rStrLength)
  633.     __OCEUtils(kOCEPToRString);
  634.  
  635.  
  636. /*    Make a Pascal string from an RString.  It's up to you to check the char set of
  637. the RString, or if the length of the RString is greater than 255 (the Pascal string's
  638. length will simply be the lower byte of the RString's length).  The StringPtr that is
  639. returned will point directly into the RString (no memory will be allocated). */
  640.  
  641. pascal StringPtr OCERToPString (const RString *rStr) __OCEUtils(kOCERToPString);
  642.  
  643.  
  644. /*    Check the relative equality of two RStrings.  Determines if str1 is greater than,
  645. equal to, or less than str2.  Result types for OCERelRString are defined in <OSUtils.h>
  646. (same as for RelString). */
  647.  
  648. pascal short OCERelRString (const void *str1, const void *str2, RStringKind kind)
  649.     __OCEUtils(kOCERelRString);
  650.  
  651.  
  652. /*    Check for equality of two RStrings. Returns true if equal. */
  653.  
  654. pascal Boolean OCEEqualRString (const void *str1, const void *str2, RStringKind kind)
  655.     __OCEUtils(kOCEEqualRString);
  656.  
  657.  
  658. /*    Check the validity of an RString.  Returns true if the RString is valid */
  659.  
  660. pascal Boolean OCEValidRString (const void *str, RStringKind kind)
  661.     __OCEUtils(kOCEValidRString);
  662.  
  663.  
  664. #ifdef __cplusplus
  665. }
  666. #endif
  667.  
  668.  
  669. /**** CreationID ****/
  670.  
  671. struct CreationID {
  672.     unsigned long source;                /* Fields definitions and usage are not defined */
  673.     unsigned long seq;
  674. };
  675.  
  676. typedef struct CreationID CreationID;
  677. typedef CreationID AttributeCreationID;
  678.  
  679.  
  680. #ifdef    __cplusplus
  681. extern "C" {
  682. #endif
  683.  
  684.  
  685. /* Returns a pointer to a null CreationID . */
  686.  
  687. pascal const CreationID *OCENullCID(void) __OCEUtils(kOCENullCID);
  688.  
  689.  
  690. /* Returns a pointer to a special CreationID used within the PathFinder. */
  691.  
  692. pascal const CreationID *OCEPathFinderCID(void) __OCEUtils(kOCEPathFinderCID);
  693.  
  694.  
  695. /* Sets the CreationID to a null value. */
  696.  
  697. pascal void OCESetCreationIDtoNull(CreationID *const cid)
  698.     __OCEUtils(kOCESetCreationIDtoNull);
  699.  
  700.  
  701. /* Copies the value of cid1 to cid2. */
  702.  
  703. pascal void OCECopyCreationID(const CreationID *cid1, CreationID *const cid2)
  704.     __OCEUtils(kOCECopyCreationID);
  705.  
  706.  
  707. /* Check the equality of two CreationIDs. */
  708.  
  709. pascal Boolean OCEEqualCreationID(const CreationID *cid1, const CreationID *cid2)
  710.     __OCEUtils(kOCEEqualCreationID);
  711.  
  712.  
  713. #ifdef __cplusplus
  714. }
  715. #endif
  716.  
  717.  
  718. /**** NetworkSpec ****/
  719.  
  720. /*
  721. For the record, a NetworkSpec is an RString with a smaller maximum size.
  722. I don't just typedef it to an RString, because I want the definition of the NetworkSpec
  723. struct to contain the max length.  But it should be possible to typecast any
  724. NetworkSpec to an RString and use all the RString utilities on it.
  725. */
  726.  
  727. struct NetworkSpec {
  728.     RStringHeader
  729.     Byte body[kNetworkSpecMaxBytes];    /* always fixed at the max size */
  730. };
  731.  
  732. typedef struct NetworkSpec NetworkSpec;
  733. typedef NetworkSpec *NetworkSpecPtr;
  734.  
  735.  
  736.  
  737. /**** PackedPathName ****/
  738.  
  739. /*
  740. struct PackedPathName is a maximum-sized structure.  Allocate one of
  741. these and it will hold any valid packed pathname.
  742. */
  743.  
  744. #define PackedPathNameHeader    \
  745.     unsigned short dataLength;        /* dataLength excludes the space for the dataLength field */
  746.  
  747. struct PackedPathName {
  748.     PackedPathNameHeader
  749.     Byte    data[kPathNameMaxBytes - sizeof(unsigned short)];
  750. };
  751.  
  752. typedef struct PackedPathName PackedPathName;
  753.  
  754. /*
  755. struct ProtoPackedPathName is a minimum-sized structure.  Use this
  756. for a variable-length packed PathName.
  757. */
  758.  
  759. struct ProtoPackedPathName {
  760.     PackedPathNameHeader
  761. /* Followed by data */
  762. };
  763.  
  764. typedef struct ProtoPackedPathName ProtoPackedPathName;
  765. typedef PackedPathName *PackedPathNamePtr;
  766. typedef ProtoPackedPathName *ProtoPackedPathNamePtr;
  767.  
  768.  
  769. #ifdef    __cplusplus
  770. extern "C" {
  771. #endif
  772.  
  773.  
  774. /*
  775. Copy the contents of path1 to path2.  path2Length is the size of path2, and must
  776. be large enough to hold a copy of path1.  A memFull error will be returned if that
  777. is not the case.
  778. */
  779.  
  780. pascal OSErr OCECopyPackedPathName(const PackedPathName *path1, PackedPathName *path2,
  781.         unsigned short path2Length)
  782.     __OCEUtils(kOCECopyPackedPathName);
  783.  
  784.  
  785. /*
  786. Returns true if packed path pointer is nil, or is of zero length, or is of
  787. length 2 and nParts of zero.
  788. */
  789.  
  790. pascal Boolean OCEIsNullPackedPathName(const PackedPathName *path)
  791.     __OCEUtils(kOCEIsNullPackedPathName);
  792.  
  793.  
  794. /*
  795. OCEUnpackPathName breaks apart the path into its component RStrings, writing string
  796. pointers into the array 'parts', which the client asserts can hold as many as
  797. 'nParts' elements. The number of parts actually found is returned.  Strings are
  798. placed in the array in order from lowest to highest.  The first pathName element
  799. beneath the root appears last.  NOTE THAT THE UNPACKED STRUCT CONTAINS POINTERS INTO
  800. THE PACKED STRUCT - DON'T DELETE OR REUSE THE PACKED STRUCT UNTIL YOU ARE FINISHED
  801. WITH THE UNPACKED STRUCT AS WELL
  802. */
  803.  
  804. pascal unsigned short OCEUnpackPathName(const PackedPathName *path, RString *const parts[],
  805.         const unsigned short nParts)
  806.     __OCEUtils(kOCEUnpackPathName);
  807.  
  808.  
  809. /*
  810. OCEPackedPathNameSize computes the number of bytes of memory needed to hold a
  811. PackedPathName manufactured from the array of parts.  This length
  812. includes the length of the length field of PackedPathName, so it
  813. is safe to do a NewPtr (OCEPackedPathNameSize(...)).
  814. */
  815.  
  816. pascal unsigned short OCEPackedPathNameSize(
  817.         const RStringPtr parts[], const unsigned short nParts)
  818.     __OCEUtils(kOCEPackedPathNameSize);
  819.  
  820.  
  821. /* OCEDNodeNameCount returns the number of RStrings contained within the path. */
  822.  
  823. pascal unsigned short OCEDNodeNameCount(const PackedPathName *path)
  824.     __OCEUtils(kOCEDNodeNameCount);
  825.  
  826.  
  827. /*
  828. OCEPackPathName packs the parts into the storage provided as 'path'.  path must be
  829. large enough to hold the packed pathname.  A memFull error will be returned if
  830. pathLength is too small.  parts[0] should contain the deepest pathName element,
  831. and parts[nParts - 1] should contain the name of the first pathName element beneath
  832. the root.
  833. */
  834.  
  835. pascal OSErr OCEPackPathName(const RStringPtr parts[], const unsigned short nParts,
  836.         PackedPathName *path, unsigned short pathLength)
  837.     __OCEUtils(kOCEPackPathName);
  838.  
  839.  
  840. /*
  841. Check the equality of two packed paths.
  842. */
  843.  
  844. pascal Boolean OCEEqualPackedPathName(const PackedPathName *path1,
  845.                     const PackedPathName *path2)
  846.     __OCEUtils(kOCEEqualPackedPathName);
  847.  
  848.  
  849. /*
  850. OCEValidPackedPathName checks that the packed PathName is internally consistent.
  851. Returns true if it's ok.
  852. */
  853.  
  854. pascal Boolean OCEValidPackedPathName(const PackedPathName *path)
  855.     __OCEUtils(kOCEValidPackedPathName);
  856.  
  857.  
  858. #ifdef __cplusplus
  859. }
  860. #endif
  861.  
  862.  
  863. /**** DirDiscriminator ****/
  864.  
  865. struct DirDiscriminator {
  866.     OCEDirectoryKind     signature;
  867.     unsigned long         misc;
  868. };
  869.  
  870. typedef struct DirDiscriminator DirDiscriminator;
  871.  
  872.  
  873. #ifdef    __cplusplus
  874. extern "C" {
  875. #endif
  876.  
  877. /* Copies the value of disc1 to disc2. */
  878.  
  879. pascal void OCECopyDirDiscriminator(const DirDiscriminator *disc1,
  880.         DirDiscriminator *const disc2)
  881.     __OCEUtils(kOCECopyDirDiscriminator);
  882.  
  883.  
  884. /* Check the equality of two DirDiscriminators. */
  885.  
  886. pascal Boolean OCEEqualDirDiscriminator(const DirDiscriminator *disc1,
  887.         const DirDiscriminator *disc2)
  888.     __OCEUtils(kOCEEqualDirDiscriminator);
  889.  
  890. #ifdef __cplusplus
  891. }
  892. #endif
  893.  
  894.  
  895. /*********************************************************************************
  896.  
  897. This structure is called RLI because it really contains all the info you
  898. need to locate a record within the entire name space.  It contains four fields.
  899. The first two are the name of the catalog and a catalog discriminator.  These
  900. two fields are used to indicate to which catalog a given record belongs.  The
  901. discriminator is used to distinguish between two different catalogs that have
  902. the same name.
  903.  
  904. The other two fields in the RLI structure are used to indicate a particular
  905. catalog node within the catalog specified by the directoryName and
  906. discriminator fields.  These fields are exactly analagous to the dirID and
  907. pathname used in HFS.  It is possible to specify a dNode just by dNodeNumber
  908. (pathname is nil), or just by pathname (dNodeNumber is set to kNULLDNodeNumber),
  909. or by a combination of the two.  The latter is called a 'partial pathname', and
  910. while it is valid in the Catalog Manager API, it is not supported by ADAP
  911. catalogs in Release 1.
  912.  
  913. Note that the path parameter does not include the catalog name, but holds
  914. the names of all the nodes on the path to the desired catalog node, starting
  915. with the catalog node and working its way up the tree.
  916.  
  917.  *********************************************************************************/
  918.  
  919.  
  920. /**** RLI ****/
  921.  
  922.  
  923. struct DirectoryName {
  924.     RStringHeader
  925.     Byte            body[kDirectoryNameMaxBytes];    /* space for catalog name */
  926. };
  927.  
  928. typedef struct DirectoryName DirectoryName;
  929. typedef DirectoryName *DirectoryNamePtr;
  930.  
  931.  
  932. typedef unsigned long DNodeNum;            /* Catalog node number */
  933.  
  934. struct RLI {                            /* Record Location Info structure: */
  935.     DirectoryNamePtr    directoryName;    /* pointer to the name of the catalog root */
  936.     DirDiscriminator    discriminator;    /* used to discriminate between dup catalog names */
  937.     DNodeNum            dNodeNumber;    /* number of the node */
  938.     PackedPathNamePtr    path;            /* old-style RLI */
  939. };
  940.  
  941. typedef struct RLI RLI;
  942. typedef RLI *RLIPtr;
  943.  
  944.  
  945.  
  946. #ifdef    __cplusplus
  947. extern "C" {
  948. #endif
  949.  
  950.  
  951. /*
  952. Create a new RLI from the catalog name, discriminator, DNode number, and
  953. PackedPathName.  You must allocate the storage for the RLI and pass in a pointer
  954. to it.
  955. */
  956.  
  957. pascal void OCENewRLI(RLI *newRLI, const DirectoryName *dirName,
  958.         DirDiscriminator *discriminator, const DNodeNum dNodeNumber,
  959.         const PackedPathName *path)
  960.     __OCEUtils(kOCENewRLI);
  961.  
  962.  
  963. /*
  964. Duplicate the contents of rli1 to rli2.  No errors are returned. This
  965. simply copies the pointers to the catalog name and path, wiping out any pointer
  966. that you might have had in there.
  967. */
  968.  
  969. pascal void OCEDuplicateRLI(const RLI *rli1, RLI *rli2)
  970.     __OCEUtils(kOCEDuplicateRLI);
  971.  
  972.  
  973. /*
  974. Copy the contents of rli1 to rli2.  rli2 must already contain
  975. pointers to structures large enough to hold copies of the corresponding
  976. fields from rli1.  A memFull error will be returned if that is not the case.
  977. So if you allocate a brand new empty destination, you must at least set up
  978. its length fields.
  979. */
  980.  
  981. pascal OSErr OCECopyRLI(const RLI *rli1, RLI *rli2) __OCEUtils(kOCECopyRLI);
  982.  
  983.  
  984. /*
  985. Check the equality of two RLIs.  This will take into account differences
  986. in the case and diacriticals of the directoryName and the PathName.
  987. NOTE THAT THIS WILL FAIL IF rli1 CONTAINS A DNODENUMBER AND A NIL PATHNAME,
  988. AND rli2 CONTAINS kNULLDNodeNumber AND A NON-NIL PATHNAME.  IN OTHER WORDS,
  989. THE TWO rlis MUST BE OF THE SAME FORM TO CHECK FOR EQUALITY.
  990. The one exception is that if the pathname is nil, a dNodeNumber of zero and
  991. kRootDNodeNumber will be treated as equal.
  992. */
  993.  
  994. pascal Boolean OCEEqualRLI(const RLI *rli1, const RLI *rli2)
  995.     __OCEUtils(kOCEEqualRLI);
  996.  
  997.  
  998. /*
  999. Check the validity of an RLI.  This checks that the catalog name length
  1000. is within bounds, and the packed pathname (if specified) is valid.
  1001. */
  1002.  
  1003. pascal Boolean OCEValidRLI(const RLI *theRLI) __OCEUtils(kOCEValidRLI);
  1004.  
  1005.  
  1006. #ifdef    __cplusplus
  1007. }
  1008. #endif
  1009.  
  1010.  
  1011. /**** PackedRLI ****/
  1012.  
  1013. /*
  1014. struct PackedRLI is a maximum-sized structure.  Allocate one of
  1015. these and it will hold any valid packed pathname.
  1016. */
  1017.  
  1018. #define PackedRLIHeader    \
  1019.     unsigned short dataLength;    /* dataLength excludes the space for the dataLength field */
  1020.  
  1021. struct PackedRLI {
  1022.     PackedRLIHeader
  1023.     Byte    data[kRLIMaxBytes];
  1024. };
  1025.  
  1026. typedef struct PackedRLI PackedRLI;
  1027.  
  1028. /*
  1029. struct ProtoPackedRLI is a minimum-sized structure.  Use this
  1030. for a variable-length packed RLI.
  1031. */
  1032.  
  1033. struct ProtoPackedRLI {
  1034.     PackedRLIHeader
  1035. /* Followed by data */
  1036. };
  1037.  
  1038. typedef struct ProtoPackedRLI ProtoPackedRLI;
  1039.  
  1040. typedef PackedRLI *PackedRLIPtr;
  1041. typedef ProtoPackedRLI *ProtoPackedRLIPtr;
  1042.  
  1043.  
  1044.  
  1045. #ifdef    __cplusplus
  1046. extern "C" {
  1047. #endif
  1048.  
  1049. /*
  1050. Copy the contents of prli1 to prli2.  prli2Length is the size of prli2, and must
  1051. be large enough to hold a copy of prli1.  A memFull error will be returned if that
  1052. is not the case.
  1053. */
  1054.  
  1055. pascal OSErr OCECopyPackedRLI(const PackedRLI *prli1, PackedRLI *prli2,
  1056.             unsigned short prli2Length)
  1057.     __OCEUtils(kOCECopyPackedRLI);
  1058.  
  1059.  
  1060. /*
  1061. OCEUnpackRLI breaks apart the prli into its components, writing pointers into
  1062. the rli structure.  NOTE THAT THE UNPACKED STRUCT CONTAINS POINTERS INTO THE
  1063. PACKED STRUCT - DON'T DELETE OR REUSE THE PACKED STRUCT UNTIL YOU ARE FINISHED
  1064. WITH THE UNPACKED STRUCT AS WELL
  1065. */
  1066.  
  1067. pascal void OCEUnpackRLI(const PackedRLI *prli, RLI *theRLI)
  1068.     __OCEUtils(kOCEUnpackRLI);
  1069.  
  1070.  
  1071. /*
  1072. OCEPackedRLISize computes the number of bytes of memory needed to hold a
  1073. PackedRLI manufactured from an RLI.  This length
  1074. includes the length of the length field of PackedRLI, so it
  1075. is safe to do a NewPtr (OCEPackedRLISize(...)).
  1076. */
  1077.  
  1078. pascal unsigned short OCEPackedRLISize(const RLI *theRLI)
  1079.     __OCEUtils(kOCEPackedRLISize);
  1080.  
  1081.  
  1082. /*
  1083. OCEPackRLI packs the RLI into the storage provided as 'prli'.  prli must be
  1084. large enough to hold the packed RLI.  A memFull error will be returned if
  1085. prliLength is too small.
  1086. */
  1087.  
  1088. pascal OSErr OCEPackRLI(const RLI *theRLI, PackedRLI *prli, unsigned short prliLength)
  1089.     __OCEUtils(kOCEPackRLI);
  1090.  
  1091.  
  1092. /*
  1093. OCEPackedRLIPartsSize computes the number of bytes of memory needed to hold a
  1094. PackedRLI manufactured from the parts of an RLI.  This length
  1095. includes the length of the length field of PackedRLI, so it
  1096. is safe to do a NewPtr (OCEPackedRLIPartsSize(...)).
  1097. */
  1098.  
  1099. pascal unsigned short OCEPackedRLIPartsSize(const DirectoryName *dirName,
  1100.             const RStringPtr parts[], const unsigned short nParts)
  1101.     __OCEUtils(kOCEPackedRLIPartsSize);
  1102.  
  1103.  
  1104. /*
  1105. OCEPackRLIParts packs the parts of an RLI into the storage provided as 'prli'.
  1106. prli must be large enough to hold the packed RLI.  A memFull error will be returned
  1107. if prliLength is too small.
  1108. */
  1109.  
  1110. pascal OSErr OCEPackRLIParts(const DirectoryName *dirName,
  1111.             const DirDiscriminator *discriminator, const DNodeNum dNodeNumber,
  1112.             const RStringPtr parts[], const unsigned short nParts, PackedRLI *prli,
  1113.             unsigned short prliLength)
  1114.     __OCEUtils(kOCEPackRLIParts);
  1115.  
  1116.  
  1117. /*
  1118. Check the equality of two packed prlis.
  1119. */
  1120.  
  1121. pascal Boolean OCEEqualPackedRLI(const PackedRLI *prli1, const PackedRLI *prli2)
  1122.     __OCEUtils(kOCEEqualPackedRLI);
  1123.  
  1124.  
  1125. /*
  1126. Check the validity of a packed RLI.  This checks that the catalog name length
  1127. is within bounds, and the packed pathname (if specified) is valid.
  1128. */
  1129.  
  1130. pascal Boolean OCEValidPackedRLI(const PackedRLI *prli)
  1131.     __OCEUtils(kOCEValidPackedRLI);
  1132.  
  1133.  
  1134. /*
  1135. If this packed RLI describes a Personal Catalog, this call will return a pointer
  1136. to an alias record that can be used to find the actual file.  Otherwise, it returns nil.
  1137. */
  1138.  
  1139. pascal AliasPtr OCEExtractAlias(const PackedRLI *prli)
  1140.     __OCEUtils(kOCEExtractAlias);
  1141.  
  1142.  
  1143. /*
  1144. This call returns a pointer to a packed RLI that represents the "Catalogs" icon, or
  1145. the root of all catalogs.  It is used in the CollabPack.
  1146. */
  1147.  
  1148. pascal const PackedRLI * OCEGetDirectoryRootPackedRLI (void)
  1149.     __OCEUtils(kOCEGetRootPackedRLI);
  1150.  
  1151.  
  1152. #ifdef __cplusplus
  1153. }
  1154. #endif
  1155.  
  1156.  
  1157.  
  1158. /**** LocalRecordID ****/
  1159.  
  1160. struct LocalRecordID {
  1161.     CreationID cid;
  1162.     RStringPtr recordName;
  1163.     RStringPtr recordType;
  1164. };
  1165.  
  1166. typedef struct LocalRecordID LocalRecordID;
  1167.  
  1168. typedef LocalRecordID *LocalRecordIDPtr;
  1169.  
  1170. #ifdef    __cplusplus
  1171. extern "C" {
  1172. #endif
  1173.  
  1174.  
  1175. /* Create a LocalRecordID from a name, type, and CreationID */
  1176.  
  1177. pascal void OCENewLocalRecordID(const RString *recordName, const RString *recordType,
  1178.         const CreationID *cid, LocalRecordID *lRID)
  1179.     __OCEUtils(kOCENewLocalRecordID);
  1180.  
  1181. /*
  1182. Copy LocalRecordID lRID1 to LocalRecordID lRID2.  lRID2 must already contain
  1183. pointers to RString structures large enough to hold copies of the corresponding
  1184. fields from lRID1.  A memFull error will be returned if that is not the case.
  1185. So if you allocate a brand new empty destination, you must at least set up
  1186. its length field.
  1187. */
  1188.  
  1189. pascal OSErr OCECopyLocalRecordID(const LocalRecordID *lRID1, LocalRecordID *lRID2)
  1190.     __OCEUtils(kOCECopyLocalRecordID);
  1191.  
  1192.  
  1193. /*
  1194. Check the equality of two local RIDs.
  1195. */
  1196.  
  1197. pascal Boolean OCEEqualLocalRecordID(const LocalRecordID *lRID1, const LocalRecordID *lRID2)
  1198.     __OCEUtils(kOCEEqualLocalRecordID);
  1199.  
  1200.  
  1201. #ifdef __cplusplus
  1202. }
  1203. #endif
  1204.  
  1205.  
  1206. /**** ShortRecordID ****/
  1207.  
  1208. struct ShortRecordID {
  1209.     PackedRLIPtr        rli;
  1210.     CreationID            cid;
  1211. };
  1212.  
  1213. typedef struct ShortRecordID ShortRecordID;
  1214. typedef ShortRecordID *ShortRecordIDPtr;
  1215.  
  1216. #ifdef    __cplusplus
  1217. extern "C" {
  1218. #endif
  1219.  
  1220.  
  1221. /* Create a ShortRecordID from an RLI struct and a CreationID */
  1222.  
  1223. pascal void OCENewShortRecordID(const PackedRLI *theRLI, const CreationID *cid,
  1224.         ShortRecordIDPtr sRID)
  1225.     __OCEUtils(kOCENewShortRecordID);
  1226.  
  1227.  
  1228. /*
  1229. Copy ShortRecordID sRID1 to ShortRecordID sRID2.  sRID2 must already contain
  1230. pointers to structures large enough to hold copies of the corresponding
  1231. fields from sRID1.  A memFull error will be returned if that is not the case.
  1232. So if you allocate a brand new empty destination, you must at least set up
  1233. its length fields.
  1234. */
  1235.  
  1236. pascal OSErr OCECopyShortRecordID(const ShortRecordID *sRID1, ShortRecordID *sRID2)
  1237.     __OCEUtils(kOCECopyShortRecordID);
  1238.  
  1239.  
  1240. /*
  1241. Check the equality of two short RIDs.
  1242. */
  1243.  
  1244. pascal Boolean OCEEqualShortRecordID(const ShortRecordID *sRID1, const ShortRecordID *sRID2)
  1245.     __OCEUtils(kOCEEqualShortRecordID);
  1246.  
  1247.  
  1248. #ifdef __cplusplus
  1249. }
  1250. #endif
  1251.  
  1252.  
  1253. /**** RecordID ****/
  1254.  
  1255. struct RecordID {
  1256.     PackedRLIPtr        rli;    /* pointer to a packed rli structure */
  1257.     LocalRecordID        local;
  1258. };
  1259.  
  1260. typedef struct RecordID RecordID;
  1261. typedef RecordID *RecordIDPtr;
  1262.  
  1263. #ifdef    __cplusplus
  1264. extern "C" {
  1265. #endif
  1266.  
  1267.  
  1268. /*    Create a RecordID from a packed RLI struct and a LocalRecordID.
  1269. This doesn't allocate any new space; the RecordID points to the same
  1270. packed RLI struct and the same name and type RStrings. */
  1271.  
  1272. pascal void OCENewRecordID(const PackedRLI *theRLI, const LocalRecordID *lRID,
  1273.             RecordID *rid)
  1274.     __OCEUtils(kOCENewRecordID);
  1275.  
  1276.  
  1277. /*
  1278. Copy RecordID RID1 to RecordID RID2.  RID2 must already contain
  1279. pointers to structures large enough to hold copies of the corresponding
  1280. fields from lRID1.  A memFull error will be returned if that is not the case.
  1281. So if you allocate a brand new empty destination, you must at least set up
  1282. its length fields.
  1283. */
  1284.  
  1285. pascal OSErr OCECopyRecordID(const RecordID *rid1, const RecordID *rid2)
  1286.     __OCEUtils(kOCECopyRecordID);
  1287.  
  1288.  
  1289. /*    Check the equality of two RIDs. */
  1290.  
  1291. pascal Boolean OCEEqualRecordID(const RecordID *rid1, const RecordID *rid2)
  1292.     __OCEUtils(kOCEEqualRecordID);
  1293.  
  1294.  
  1295. #ifdef __cplusplus
  1296. }
  1297. #endif
  1298.  
  1299.  
  1300.  
  1301. /**** PackedRecordID ****/
  1302.  
  1303. /*
  1304. struct PackedRecordID is a maximum-sized structure.  Allocate one of
  1305. these and it will hold any valid packed RecordID.
  1306. */
  1307.  
  1308. #define PackedRecordIDHeader    \
  1309.     unsigned short dataLength;        /* dataLength excludes the space for the dataLength field */
  1310.  
  1311. struct PackedRecordID {
  1312.     PackedRecordIDHeader
  1313.     Byte    data[kPackedRecordIDMaxBytes];
  1314. };
  1315.  
  1316. typedef struct PackedRecordID PackedRecordID;
  1317.  
  1318. /*
  1319. struct ProtoPackedRecordID is a minimum-sized structure.  Use this
  1320. for a variable-length packed RecordID.
  1321. */
  1322.  
  1323. struct ProtoPackedRecordID {
  1324.     PackedRecordIDHeader
  1325. /* Followed by data */
  1326. };
  1327.  
  1328. typedef struct ProtoPackedRecordID ProtoPackedRecordID;
  1329. typedef PackedRecordID *PackedRecordIDPtr;
  1330. typedef ProtoPackedRecordID *ProtoPackedRecordIDPtr;
  1331.  
  1332. #ifdef    __cplusplus
  1333. extern "C" {
  1334. #endif
  1335.  
  1336.  
  1337. /*
  1338. Copy PackedRecordID pRID1 to PackedRecordID pRID2.  pRID2 must already contain
  1339. pointers to structures large enough to hold copies of the corresponding
  1340. fields from pRID1.  A memFull error will be returned if that is not the case.
  1341. pRID2Length is the number of bytes that can be put into pRID2, not counting the
  1342. packed RecordID header.
  1343. */
  1344.  
  1345. pascal OSErr OCECopyPackedRecordID(const PackedRecordID *pRID1, const PackedRecordID *pRID2,
  1346.         unsigned short pRID2Length)
  1347.     __OCEUtils(kOCECopyPackedRecordID);
  1348.  
  1349.  
  1350. /*
  1351. Create a RecordID from a PackedRecordID.
  1352. NOTE THAT THE UNPACKED STRUCT CONTAINS POINTERS INTO THE PACKED STRUCT - DON'T DELETE
  1353. OR REUSE THE PACKED STRUCT UNTIL YOU ARE FINISHED WITH THE UNPACKED STRUCT AS WELL
  1354. */
  1355.  
  1356. pascal void OCEUnpackRecordID(const PackedRecordID *pRID, RecordID *rid)
  1357.     __OCEUtils(kOCEUnpackRecordID);
  1358.  
  1359.  
  1360. /*
  1361. Create a PackedRecordID from a RecordID.  pRID must be large enough to contain
  1362. the packed RecordID.  A memFull error will be returned if that is not the case.
  1363. packedRecordIDLength is the number of bytes that can be put into pRID, not
  1364. counting the header.
  1365. */
  1366.  
  1367. pascal OSErr OCEPackRecordID(const RecordID *rid, PackedRecordID *pRID,
  1368.         unsigned short packedRecordIDLength)
  1369.     __OCEUtils(kOCEPackRecordID);
  1370.  
  1371.  
  1372. /*
  1373. Compute the number of bytes of memory needed to hold a RecordID when packed. This
  1374. length includes the length of the length field of PackedRecordID, so it
  1375. is safe to do a NewPtr (OCEPackedRecordIDSize(...)).
  1376. */
  1377.  
  1378. pascal unsigned short OCEPackedRecordIDSize(const RecordID *rid)
  1379.     __OCEUtils(kOCEPackedRecordIDSize);
  1380.  
  1381.  
  1382. /*
  1383. Check the equality of two packed RIDs.
  1384. */
  1385.  
  1386. pascal Boolean OCEEqualPackedRecordID(const PackedRecordID *pRID1, const PackedRecordID *pRID2)
  1387.     __OCEUtils(kOCEEqualPackedRecordID);
  1388.  
  1389.  
  1390. /* OCEValidPackedRecordID checks the validity of a packed record ID. */
  1391.  
  1392. pascal Boolean OCEValidPackedRecordID(const PackedRecordID *pRID)
  1393.     __OCEUtils(kOCEValidPackedRecordID);
  1394.  
  1395.  
  1396. #ifdef __cplusplus
  1397. }
  1398. #endif
  1399.  
  1400.  
  1401.  
  1402. /**** DSSpec ****/
  1403.  
  1404. struct DSSpec {
  1405.     RecordID            *entitySpecifier;
  1406.     OSType                extensionType;
  1407.     unsigned short        extensionSize;
  1408.     Ptr                    extensionValue;
  1409. };
  1410.  
  1411. typedef struct DSSpec DSSpec;
  1412. typedef DSSpec *DSSpecPtr;
  1413.  
  1414. /*
  1415. struct PackedDSSpec is NOT a maximum-sized structure.  Allocate one of
  1416. these and it will hold any valid packed RecordID, but not necessarily any additional
  1417. data.
  1418. */
  1419.  
  1420. #define PackedDSSpecHeader    \
  1421.     unsigned short         dataLength;        /* dataLength excludes the space for the dataLength field */
  1422.  
  1423. struct PackedDSSpec {
  1424.     PackedDSSpecHeader
  1425.     Byte                data[kPackedDSSpecMaxBytes];
  1426. };
  1427.  
  1428. typedef struct PackedDSSpec PackedDSSpec;
  1429.  
  1430. /*
  1431. struct ProtoPackedDSSpec is a minimum-sized structure.  Use this
  1432. for a variable-length packed DSSpec.
  1433. */
  1434.  
  1435. struct ProtoPackedDSSpec {
  1436.     PackedDSSpecHeader
  1437. /* Followed by data */
  1438. };
  1439.  
  1440. typedef struct ProtoPackedDSSpec ProtoPackedDSSpec;
  1441. typedef PackedDSSpec *PackedDSSpecPtr;
  1442. typedef ProtoPackedDSSpec *ProtoPackedDSSpecPtr;
  1443.  
  1444.  
  1445. #ifdef __cplusplus
  1446. extern "C" {
  1447. #endif
  1448.  
  1449. /*
  1450. Copy PackedDSSpec pdss1 to PackedDSSpec pdss2.  pdss2 must already contain
  1451. pointers to structures large enough to hold copies of the corresponding
  1452. fields from pdss1.  A memFull error will be returned if that is not the case.
  1453. pdss2Length is the number of bytes that can be put into pdss2, not counting the
  1454. packed DSSpec header.
  1455. */
  1456.  
  1457. pascal OSErr OCECopyPackedDSSpec(const PackedDSSpec *pdss1,
  1458.             const PackedDSSpec *pdss2, unsigned short pdss2Length)
  1459.     __OCEUtils(kOCECopyPackedDSSpec);
  1460.  
  1461.  
  1462. /*
  1463. Create a DSSpec from a PackedDSSpec.
  1464. NOTE THAT THE UNPACKED STRUCT CONTAINS POINTERS INTO THE PACKED STRUCT - DON'T DELETE
  1465. OR REUSE THE PACKED STRUCT UNTIL YOU ARE FINISHED WITH THE UNPACKED STRUCT AS WELL.
  1466. A pointer to the extension is returned in dss->extensionValue, and the length of that
  1467. extension is returned in dss->extensionSize.  If there is no extension, dss->extensionValue will
  1468. be set to nil.  This routine will unpack the RecordID (if any) into rid, unpack the rest
  1469. into dss, and set dss->entitySpecifier to rid.
  1470. */
  1471.  
  1472. pascal void OCEUnpackDSSpec(const PackedDSSpec *pdss, DSSpec *dss,
  1473.             RecordID *rid) __OCEUtils(kOCEUnpackDSSpec);
  1474.  
  1475.  
  1476. /*
  1477. Create a PackedDSSpec from a DSSpec.  pdss must be large enough to
  1478. contain the packed RecordID and any extension.  A memFull error will be returned if that
  1479. is not the case.  pdssLength is the number of bytes that can be put into pdss,
  1480. not counting the header.
  1481. */
  1482.  
  1483. pascal OSErr OCEPackDSSpec(const DSSpec *dss, PackedDSSpec *pdss,
  1484.         unsigned short pdssLength)
  1485.     __OCEUtils(kOCEPackDSSpec);
  1486.  
  1487.  
  1488. /*
  1489. Compute the number of bytes of memory needed to hold a DSSpec when packed. This
  1490. length includes the length of the length field of PackedDSSpec, so it
  1491. is safe to do a NewPtr (OCEPackedDSSpecSize(...)).
  1492. */
  1493.  
  1494. pascal unsigned short OCEPackedDSSpecSize(const DSSpec *dss)
  1495.     __OCEUtils(kOCEPackedDSSpecSize);
  1496.  
  1497.  
  1498. /*    Check the equality of two DSSpecs.  This compares all fields, even the
  1499. extension (unless extensionSize == 0).  The extensions are compared in a case-insensitive and
  1500. diacrit-insensitive manner. */
  1501.  
  1502. pascal Boolean OCEEqualDSSpec(const DSSpec *pdss1, const DSSpec *pdss2)
  1503.     __OCEUtils(kOCEEqualDSSpec);
  1504.  
  1505.  
  1506. /*    Check the equality of two PackedDSSpecs.  This compares all fields, even the
  1507. extension (unless extensionSize == 0).  The extensions are compared in a case-insensitive and
  1508. diacrit-insensitive manner. */
  1509.  
  1510. pascal Boolean OCEEqualPackedDSSpec(const PackedDSSpec *pdss1,
  1511.         const PackedDSSpec *pdss2)
  1512.     __OCEUtils(kOCEEqualPackedDSSpec);
  1513.  
  1514.  
  1515. /*
  1516. Check the validity of a PackedDSSpec.  If extensionType is
  1517. 'entn', pdss must contain a valid entitySpecifier.  For all other extensionTypes, a nil
  1518. entitySpecifier is valid, but if non-nil, it will be checked for validity.  No check
  1519. is made on the extension.
  1520. */
  1521.  
  1522. pascal Boolean OCEValidPackedDSSpec(const PackedDSSpec *pdss)
  1523.     __OCEUtils(kOCEValidPackedDSSpec);
  1524.  
  1525.  
  1526. /*
  1527. Return info about a DSSpec.  This routine does not check validity.  If the
  1528. DSSpec has no extension, we determine whether it represents the root of all
  1529. catalogs, a single catalog, a DNode, or a Record.  Else it is invalid.
  1530. If the DSSpec has an extension, we simply return the extension type.
  1531. */
  1532.  
  1533. pascal OSType OCEGetDSSpecInfo(const DSSpec *spec)
  1534.     __OCEUtils(kOCEGetDSSpecInfo);
  1535.  
  1536.  
  1537. /* OCEGetExtensionType returns the extensionType imbedded in the PackedDSSpec. */
  1538.  
  1539. pascal OSType OCEGetExtensionType(const PackedDSSpec *pdss)
  1540.     __OCEUtils(kOCEGetXtnType);
  1541.  
  1542.  
  1543. /*
  1544. OCEStreamPackedDSSpec streams (flattens) a catalog object a little at a time by
  1545. calling the DSSpecStreamer routine that you provide.
  1546. */
  1547.  
  1548. typedef pascal OSErr (*DSSpecStreamer)(void *buffer, unsigned long count, Boolean eof,
  1549.         long userData);
  1550.  
  1551. pascal OSErr OCEStreamPackedDSSpec(const DSSpec *dss, DSSpecStreamer stream,
  1552.         long userData, unsigned long *actualCount)
  1553.     __OCEUtils(kOCEStreamPackedDSSpec);
  1554.  
  1555.  
  1556. #ifdef __cplusplus
  1557. }
  1558. #endif
  1559.  
  1560.  
  1561.  
  1562. /**** AttributeType ****/
  1563.  
  1564. /*
  1565. For the record, an AttributeType is an RString with a smaller maximum size.
  1566. I don't just typedef it to an RString, because I want the definition of the AttributeType
  1567. struct to contain the max length, because I need to include it in the Attribute struct
  1568. below.  But it should be possible to typecast any AttributeType to an RString and use
  1569. all the RString utilities on it.
  1570. */
  1571.  
  1572. struct AttributeType {
  1573.     RStringHeader
  1574.     Byte body[kAttributeTypeMaxBytes];    /* always fixed at the max size */
  1575. };
  1576.  
  1577. typedef struct AttributeType AttributeType;
  1578. typedef AttributeType *AttributeTypePtr;
  1579.  
  1580.  
  1581.  
  1582. /**** AttributeValue ****/
  1583.  
  1584. typedef DescType AttributeTag;            /* same class as is used in AppleEvents */
  1585.  
  1586. struct AttributeValue {
  1587.     AttributeTag    tag;
  1588.     unsigned long    dataLength;
  1589.     Ptr                bytes;
  1590.     };
  1591.  
  1592. typedef struct AttributeValue AttributeValue;
  1593. typedef AttributeValue *AttributeValuePtr;
  1594.  
  1595.  
  1596. /**** Attribute ****/
  1597.  
  1598. struct Attribute {
  1599.     AttributeType        attributeType;
  1600.     AttributeCreationID    cid;
  1601.     AttributeValue        value;
  1602. };
  1603.  
  1604. typedef struct Attribute Attribute;
  1605. typedef Attribute *AttributePtr;
  1606.  
  1607.  
  1608. #ifdef __cplusplus
  1609. extern "C" {
  1610. #endif
  1611.  
  1612. pascal RString *OCEGetIndRecordType(const OCERecordTypeIndex stringIndex)
  1613.     __OCEUtils(kOCEGetIndRecordType);
  1614.  
  1615. pascal AttributeType *OCEGetIndAttributeType(const OCEAttributeTypeIndex stringIndex)
  1616.     __OCEUtils(kOCEGetIndAttributeType);
  1617.  
  1618. #ifdef __cplusplus
  1619. }
  1620. #endif
  1621.  
  1622. #define _oceTBDispatch            0xAA5E
  1623.  
  1624. #endif
  1625.  
  1626. #endif
  1627.